home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / tsr25src.arc / TSR.DOC < prev    next >
Text File  |  1987-06-02  |  22KB  |  525 lines

  1. ****************************************************************
  2. *                TSR Utilities Version 2.5                     *
  3. *   The TSR Utilities include programs useful in managing      *
  4. *   DOS memory, and in particular managing memory-resident     *
  5. *  utilities. TSR stands for "Terminate and Stay Resident".    *
  6. *                                                              *
  7. ****************************************************************
  8.  
  9. A. Introduction
  10. ================================================================
  11.  
  12. The TSR Utilities have grown to include 8 programs. Here's a
  13. quick overview of each one:
  14.  
  15.   MARK - marks a position above which TSRs can be released.
  16.   RELEASE - removes TSRs from memory.
  17.   FMARK - performs the same function as MARK but uses less memory.
  18.   MAPMEM - shows what memory resident programs are loaded.
  19.   WATCH - a TSR itself, it keeps detailed records of other TSRs.
  20.   DISABLE - disables or reactivates TSRs kept in memory.
  21.   RAMFREE - shows how much RAM memory is available.
  22.   EATMEM - uses up memory for controlled program testing.
  23.  
  24. The programs are described in more detail in the following
  25. sections.
  26.  
  27.  
  28. B. MARK, FMARK and RELEASE
  29. ================================================================
  30.  
  31. MARK.COM and RELEASE.COM are used to remove memory-resident
  32. programs from memory, without requiring a system reboot, and
  33. without the usual problems of creating holes or leaving
  34. interrupts dangling. The two programs are used simply as follows:
  35.  
  36. 1) Run the program MARK.COM before installing any memory-
  37.    resident program that you may wish to deinstall later.
  38.    This marks the current position in memory and stores the
  39.    DOS interrupt vector table (all interrupts from 0 to FFH).
  40.  
  41. 2) Install whatever TSRs that you want to use, in the normal
  42.    way that you install them.
  43.  
  44. 3) When you want to deinstall all TSRs above the last MARK,
  45.    run the program RELEASE.COM. This will release all of the
  46.    memory above (and including) the last MARK, and restore
  47.    all interrupt vectors taken over by the memory resident
  48.    programs.
  49.  
  50. MARK and RELEASE can be "stacked" as many times as desired.
  51. RELEASE releases the memory above the last MARK call. MARK uses
  52. about 1600 bytes of memory each time it is called. This 1600
  53. byte region is also released when a RELEASE is done. MARK memory
  54. usage is dominated by the copies of the DOS interrupt vector
  55. table (interrupts 0..FFh) and the copy of the EMS page map
  56. (blocks 0..31 only) which MARK keeps when it goes resident.
  57.  
  58. ----------------------------------------------------------------
  59.  
  60. MARK and RELEASE can optionally be called with a single command
  61. line parameter:
  62.  
  63.   MARK MarkName
  64.   RELEASE MarkName
  65.  
  66. In this way a particular mark is given a name. Calling RELEASE
  67. with the same name will release all memory above and including
  68. the mark of that name, also releasing any intermediate marks in
  69. the process. If no mark of the proper name is found, RELEASE
  70. will halt with a warning. A RELEASE call with no MarkName
  71. specified will release the last MARK, whether or not that MARK
  72. was named.
  73.  
  74. The MarkName can be any text string up to 126 characters in
  75. length. It may not contain embedded blanks or tabs. Case (upper
  76. or lower) is not important when matching MarkNames.
  77.  
  78. MarkName supports an additional feature. If the MarkName begins
  79. with ! (exclamation point), then the mark is called a "protected
  80. mark". That mark can be released *only* by an exact match to its
  81. name (including the exclamation point). A protected mark will
  82. NOT be released with an "unnamed" RELEASE. Any named or unnamed
  83. RELEASE will stop without releasing any memory if it encounters
  84. a protected mark that it does not match exactly.
  85.  
  86. ----------------------------------------------------------------
  87.  
  88. As of version 1.4, MARK and RELEASE also control Expanded memory
  89. (Lotus/Intel/Microsoft EMS). They have been tested with READY!
  90. and with the TurboPower Software expanded memory disk cache, as
  91. well as with the device drivers used by the STB Expanded Memory
  92. Card.
  93.  
  94. WARNING: if a resident application allocates expanded memory at
  95. some time *after* going resident and after the last MARK made,
  96. that expanded memory will be released by a call to RELEASE. The
  97. current expanded memory manager (EMM) does not give us enough
  98. information to avoid this possibility. Fortunately, there are no
  99. known memory resident programs which perform this dynamic
  100. allocation of expanded memory. We hope that the EMM will be
  101. upgraded before such applications are designed.
  102.  
  103. ----------------------------------------------------------------
  104.  
  105. As of version 1.6, RELEASE takes special precautions to allow it
  106. to release extra invocations of the DOS command processor. In
  107. the simplest form, an extra command processor is obtained by
  108. typing COMMAND at the DOS level. Many multitasking or switching
  109. utilities also utilize this feature of DOS, and these utilities
  110. can now be managed via MARK and RELEASE.
  111.  
  112. ----------------------------------------------------------------
  113.  
  114. Due to the way DOS handles batch files, there are certain
  115. limitations on using RELEASE within batch. You *cannot* perform
  116. the following sequence of events successfully:
  117.  
  118. First, from the DOS command line:
  119.  
  120.   MARK
  121.   SK      {SideKick, or any other resident program or programs}
  122.  
  123. Then, within a batch file:
  124.  
  125.   RELEASE {get rid of SK and MARK}
  126.   LOTUS   {run Lotus using the additional memory}
  127.   MARK    {put SK back in place}
  128.   SK
  129.  
  130. DOS allocates a small memory block prior to running any batch
  131. file. It does not allow that block to be deallocated from within
  132. the batch file without various errors occurring. As a result, in
  133. this case the MARK and SK memory blocks are effectively trapped
  134. until the batch file is completed, after which the memory will
  135. be reusable. Indeed, if you run the batch file presented above,
  136. you will get MARK and SK installed above a big hole in memory
  137. left by the previous images of MARK and SK.
  138.  
  139. As of version 1.9, RELEASE guards against this possibility. If
  140. it senses that you are attempting to release memory trapped by a
  141. "batch control block", it writes a warning message to that
  142. effect. It still releases the memory, but when it exits it
  143. passes back a return code of 1 rather than the usual value of 0.
  144.  
  145. You *can* obtain the desired effect in at least two other ways.
  146. First, you could make two batch files and call them one after the
  147. other:
  148.  
  149. Batch file #1:
  150.   RELEASE
  151.  
  152. Batch file #2:
  153.   LOTUS
  154.   MARK
  155.   SK
  156.  
  157. In this case, running RELEASE in batch file #1 has the same
  158. effect as running RELEASE from the DOS command line. However,
  159. directly calling the second batch file from the first doesn't
  160. always seem to work either. The only sure bet appears to be the
  161. use of a keypoker like STACKEY, KEY-FAKE or PCED's KEYIN,
  162. modifying Batch #1 as follows:
  163.  
  164.   RELEASE
  165.   KEY-FAKE "batch2" 13
  166.  
  167. A better way to make these things happen is to use the public
  168. domain program CED, or its commercial upgrade PCED. These
  169. programs allow you to define "synonyms" for groups of commands.
  170. The commands execute one after the other just like a batch file.
  171. However, the synonyms do not create an extra batch control
  172. memory block which causes the problems just described.
  173.  
  174. Thus you could make two CED synonyms as follows. (We assume that
  175. the CED "chain character" is ^).
  176.  
  177. SYN LOADSK 'mark !sk^sk'
  178.   {create a protected sidekick marker and load sidekick}
  179.  
  180. SYN RUNLOT 'release !sk^lotus^mark !sk^sk'
  181.   {release sidekick if it's there, run lotus, then reload sidekick}
  182.  
  183. Note: you can obtain PCED by calling Cove Software at
  184. 301-992-9371.
  185.  
  186. ----------------------------------------------------------------
  187.  
  188. Regarding PCED, please note the following: PCED supports
  189. "user-installed commands" such as KEYIN, HS, RAW and others. MARK
  190. and RELEASE are unable to release these user-installed commands
  191. individually. That is, if your AUTOEXEC.BAT looked like the
  192. following:
  193.  
  194.   CED
  195.   MARK
  196.   KEYINST
  197.  
  198. then typing RELEASE would sooner or later cause your system to
  199. crash. RELEASE cannot inform PCED that its installed command is
  200. gone, and PCED will continue to try to use code which is no
  201. longer in memory.
  202.  
  203. PCED itself provides a "KILL" command which removes
  204. specified user-installed programs from memory. Use the KILL
  205. command if you want to remove PCED's user-installed commands from
  206. memory.
  207.  
  208. MARK and RELEASE can safely be used with PCED's commands as long
  209. as PCED itself is removed from memory when the commands are.
  210.  
  211. ----------------------------------------------------------------
  212.  
  213. As of version 2.0, a new form of marking, called a "file
  214. mark", is also supported. The new mark has the advantage that it
  215. uses only about 150 bytes of memory rather than the 1600 of MARK.
  216.  
  217. The new mark is placed with the command
  218.  
  219.     FMARK [d:][directory]filename
  220.  
  221. The bulk of the vector table and EMS page map are stored in the
  222. file which you specify on the command line rather than in
  223. memory. Note that a command line parameter is *required* in this
  224. case. Otherwise FMARK will halt with an error. The file created
  225. by FMARK will be between 1000 and 2000 bytes in size, depending
  226. on usage of expanded memory.
  227.  
  228. If you will switch drives or directories after using FMARK, you
  229. should specify a complete pathname when FMARK is initially
  230. called. To avoid confusion, you may want to keep the FMARK files
  231. in the root directory, or in a separate directory defined just
  232. for this purpose.
  233.  
  234. The RELEASE program can release either an in-memory mark (placed
  235. by MARK.COM) or a file mark (placed by FMARK.COM). Use of RELEASE
  236. with in-memory marks is described above. To use RELEASE with
  237. file marks, call it with the name of the mark file on the command
  238. line:
  239.  
  240.     RELEASE [d:][directory]filename
  241.  
  242. In this case the filename must be specified on the command line,
  243. and only a file mark *exactly* matching the command line will be
  244. released. If the specified mark file is not found, RELEASE will
  245. halt with an error message. When the memory is released, the mark
  246. file is also deleted from disk.
  247.  
  248. There is no direct equivalent of protected marks for FMARK. If
  249. an unnamed RELEASE finds an in-memory mark below a file mark,
  250. the file mark will be released in the process of the unnamed
  251. release. In this case, the mark file will not be deleted from
  252. disk.
  253.  
  254. ----------------------------------------------------------------
  255.  
  256. Version 2.1 of RELEASE fixes a stupid bug in 2.0. This bug lead
  257. to reports of RELEASE printing its status message on the
  258. printer, and to some system crashes. The bug was caused by
  259. writing over the first two bytes of the DOS file handle table at
  260. offset 0018H in the PSP.
  261.  
  262. ----------------------------------------------------------------
  263.  
  264. Version 2.2 of RELEASE adds a few new features. These features
  265. are activated by command line switches. The valid switches are
  266. as follows:
  267.  
  268.   /K    release memory above the specified MARK, but Keep the
  269.         MARK itself in memory. This switch is useful if you plan
  270.         to reinstall the released TSRs later.
  271.  
  272.   /R    Revector the 8259 interrupt controller(s) to powerup
  273.         state. This option is useful for TSRs that patch in to
  274.         the system at a very low level. Examples include network
  275.         operating system shells, multitaskers, etc. Use this
  276.         option with caution; that is, test it at a time when
  277.         no useful work is loaded into memory.
  278.  
  279.   /?    Show a brief help screen and halt.
  280.  
  281. Any of these options are acceptable when preceded by a '-', for
  282. example, -K instead of /K.
  283.  
  284. The /R option now allows the release of DesqView, Windows, and
  285. TaskView from memory. We hope that it will allow the release of
  286. network shells, but have not been able to test it. DoubleDOS
  287. unfortunately cannot be released even with the /R option. (It
  288. apparently patches DOS itself when it is installed.)
  289.  
  290. Version 2.2 of RELEASE also restores a few additional memory
  291. locations from the MARK. It restores 8 bytes at 40:A8
  292. (associated with the EGA) and 16 bytes at 40:F0 (the
  293. interapplications communications area).
  294.  
  295. ----------------------------------------------------------------
  296.  
  297. Version 2.3 of RELEASE adds support for the new WATCH feature of
  298. the TSR Utilities. There will be no apparent difference in
  299. RELEASE's behavior, but behind the scenes, it is updating the
  300. WATCH data area whenever you release TSRs from memory.
  301.  
  302. ----------------------------------------------------------------
  303.  
  304. Version 2.4 of RELEASE slightly changes the way that EMS expanded
  305. memory is managed. We have had a number of reports of EMS clones
  306. in which one of the EMS library functions that we use is not
  307. correctly implemented. Since there is an alternate means of
  308. getting the same information, and apparently the alternate means
  309. is more reliably implemented, we have changed RELEASE (and
  310. MAPMEM). See the source code if you care about the details.
  311.  
  312. We have also added a new RELEASE command line switch, /N, which
  313. causes RELEASE to avoid touching EMS memory at all. Since so few
  314. memory resident programs use expanded memory, this switch will
  315. allow RELEASE to be used for the majority of programs even if a
  316. conflict with the EMS driver occurs.
  317.  
  318.  
  319. C. MAPMEM and WATCH
  320. ================================================================
  321.  
  322. MAPMEM.COM is used to display the current DOS memory map. It shows
  323. the resident programs, how much memory they use, and what interrupt
  324. vectors each currently controls. MAPMEM also shows information
  325. about expanded memory when such a driver is installed. MAPMEM
  326. writes to the standard output -- thus the output can be printed
  327. or stored to a file by using DOS redirection.
  328.  
  329. MAPMEM shows MARKs and FMARKs so that you can examine them prior
  330. to a RELEASE. A MARK will show the owner name "MARK", and the
  331. mark name (if any) in the command line area. An FMARK will show
  332. "N/A" in the owner column (due to the minimal memory kept by an
  333. FMARK), and the name of the mark file in the command line area.
  334.  
  335. MAPMEM supports the following command line options:
  336.  
  337.      /V     Verbose report.
  338.      /?     Write a brief help screen.
  339.  
  340. MAPMEM accepts either "/" or "-" to delimit the command line
  341. options.
  342.  
  343. On the Verbose report, the "Files" column shows the number of
  344. file handles that each resident block has kept open. Each block
  345. of memory reported by DOS is listed individually in verbose
  346. mode. This is useful in debugging problems, either with the TSR
  347. Utilities themselves, or perhaps with the resident programs that
  348. you are using.
  349.  
  350. By default, each "hooked vector" that MAPMEM reports shows only
  351. the current owner of the vector. Any previous owners now chained
  352. onto the list are not shown. Because of the technique used,
  353. MAPMEM may report some bogus hooked vectors (generally high
  354. numbered ones). If WATCH has been installed, however, MAPMEM
  355. reads the WATCH information area in memory and shows the vectors
  356. for which any TSR gains control. No bogus values should appear
  357. in this case.
  358.  
  359. ----------------------------------------------------------------
  360.  
  361. WATCH.COM is a resident program that keeps track of other memory
  362. resident programs. As a TSR goes resident, WATCH updates a data
  363. area in memory that contains information about what interrupt
  364. vectors were taken over. This information can later be used by
  365. MAPMEM and DISABLE to show more details about interrupts than
  366. normally available.
  367.  
  368. Installation of WATCH.COM is optional. All of the TSR Utilities
  369. except DISABLE can be used whether or not WATCH is installed.
  370.  
  371. If you want to use it, WATCH.COM should be installed as the
  372. first TSR in your AUTOEXEC.BAT file. WATCH uses about 4000 bytes
  373. of memory when it is installed. Most of this memory holds various
  374. information about the TSRs installed in the system -- it includes
  375. two copies of the interrupt vector table, and one data area which
  376. shows what interrupt vectors were taken over by each TSR. This
  377. information is used by DISABLE to deactivate and reactivate TSRs
  378. without removing them from memory.
  379.  
  380.  
  381. D. DISABLE
  382. ================================================================
  383.  
  384. DISABLE is a program new to TSR Utilities version 2.3. With it,
  385. you can disable and reenable specified memory resident programs
  386. without removing them from memory. Its function is analogous to
  387. that performed by REFEREE from Persoft, although DISABLE has
  388. neither a fancy user interface nor an option to work from within
  389. other programs. DISABLE can allow conflicting TSRs to coexist.
  390.  
  391. In order to use DISABLE, you must install WATCH.COM as the first
  392. memory resident program in your system. WATCH keeps the detailed
  393. information about each memory resident program that DISABLE uses
  394. to later control them.
  395.  
  396. Like the other TSR Utilities, DISABLE is operated from the
  397. command line. You specify a single TSR by its name (if you are
  398. running DOS 3.x) or by its address as determined from a MAPMEM
  399. report. If you specify an address, immediately precede the
  400. address with a dollar sign "$" and specify the address in
  401. hexadecimal.
  402.  
  403. The name specified for a TSR is the one reported by MAPMEM in the
  404. "owner" column. If the owner column reports "N/A", then you must
  405. instead specify the address from the "PSP" column.
  406.  
  407. DISABLE accepts the following command line syntax:
  408.  
  409.   DISABLE TSRname|$PSPaddress [Options]
  410.  
  411. Options may be preceded by either / or -. Valid options
  412. are as follows:
  413.  
  414.      /A     reActivate the specified TSR.
  415.      /?     Write a brief help screen.
  416.  
  417. If no option is specified, DISABLE will disable the named TSR.
  418.  
  419. Examples of usage:
  420.   DISABLE SK        {disables SideKick}
  421.   DISABLE SK /A     {reenables SideKick}
  422.   DISABLE $2F2E     {disables the TSR at address 2F2E}
  423.  
  424. MAPMEM will indicate disabled TSRs by displaying the word
  425. "disabled" in the interrupt vector column of the report.
  426.  
  427.  
  428. E. RAMFREE and EATMEM
  429. ================================================================
  430.  
  431. RAMFREE.COM supplies a fast way to determine the amount of free
  432. RAM without going through CHKDSK. Just type RAMFREE and it will
  433. quickly report the free bytes of RAM.
  434.  
  435. EATMEM.COM is useful for program development. When you want to
  436. test software in an environment with a desired amount of
  437. available memory, EATMEM will install itself to use up any
  438. desired amount. The memory used by EATMEM can be freed by using
  439. MARK and RELEASE. Call EATMEM with a single command line
  440. parameter, specifying the (decimal) number of KILOBYTES to eat
  441. up:
  442.  
  443.   EATMEM KiloBytesToEat
  444.  
  445. EATMEM will happily allow you to eat up all available memory,
  446. leading to a system crash when COMMAND.COM cannot be reloaded. Be
  447. sure to calculate how much memory to use before calling EATMEM.
  448.  
  449.  
  450. F. The Story Behind the TSR Utilities
  451. ================================================================
  452.  
  453. These programs should work on any system running PC-DOS or MS-DOS
  454. 2.0 or later. They were developed on a Compaq Deskpro 286 running
  455. Compaq DOS 3.0 and have subsequently been tested on a number of
  456. different systems.
  457.  
  458. Complete source code for the TSR Utilities is available in the
  459. file TSRSRC.ARC. MARK, FMARK, WATCH, RAMFREE and EATMEM are
  460. written in assembly language (MASM), while DISABLE, MAPMEM and
  461. RELEASE are written in Turbo Pascal. TSRSRC requires that you
  462. have Turbo Pascal version 3. On CompuServe, TSRSRC is found in
  463. the Borland SIG (Go BOR-100) in data library 3 (DL3).
  464.  
  465. These programs are copyrighted, but may be freely distributed for
  466. personal, non-commercial use. You may use them yourself, give
  467. them to your friends or co-workers, or distribute them for a
  468. cost-based fee as part of a user's group or bulletin board
  469. service. If you wish to distribute these programs as part of a
  470. commercial package, please contact us for a license agreement.
  471.  
  472. These programs were originally developed as an exercise in
  473. understanding DOS memory management. We request no donation.
  474. However, we will request $10 to cover our cost and time if you
  475. ask us to ship a disk to you.
  476.  
  477. TurboPower Software is in the business of Turbo Pascal
  478. programming tools for serious developers. Our first product, the
  479. TurboPower Utilities, contains 9 programs including an
  480. intelligent cross-referencer, a pretty printer, an execution
  481. profiler and several DOS file and text management tools.
  482.  
  483. Our second product, Turbo EXTENDER, lets Turbo Pascal programs
  484. grow beyond 64K bytes in size via modular compilation and
  485. linking. It also provides a toolbox of routines for virtual array
  486. management, as well as analytical tools for overlayed programs.
  487.  
  488. Our third product, T-DebugPLUS, is an expanded and fully
  489. supported version of the popular public domain program TDEBUG. It
  490. includes both a fully symbolic debugger integrated with the Turbo
  491. Pascal development environment, and also the ability to generate
  492. DOS standard MAP files for use with other external symbolic
  493. debuggers such as Periscope, Symdeb, and Atron.
  494.  
  495. If you have seen prior versions of the TSR Utilities, you may
  496. note that the COM files in version 2.5 are significantly smaller
  497. than before. The assembler programs are smaller due to a
  498. conversion to the MicroSoft assembler, which allowed us to keep
  499. static data structures out of the COM files. The Pascal programs
  500. are smaller due to the application of TurboPower Software's new
  501. product, Turbo Optimizer. Optimizer automatically removes the
  502. unused portions of Turbo Pascal's runtime library, and also
  503. optimizes the compiler generated code, making it smaller and
  504. faster.
  505.  
  506. The TSR Utilities were written by Kim Kokkonen, with thanks to
  507. Neil Rubenking for the original idea behind MARK and RELEASE.
  508. Also my thanks to Richard Wilson and Barry Simon at CalTech for
  509. the idea that lead to FMARK, and for much useful correspondence
  510. about the TSR Utilities.
  511.  
  512. We can be reached at:
  513.  
  514.      TurboPower Software
  515.      3109 Scotts Valley Drive #122
  516.      Scotts Valley, CA 95066
  517.      408-438-8608 (voice only, Monday-Friday 9AM-5PM)
  518.      Compuserve: 72457,2131
  519.  
  520. Version 2.5 - 6/2/87 - fixes some minor bugs, and adds
  521.   version checking between MARK and RELEASE.
  522.  
  523. The TSR Utilities are Copyright (c) 1986,1987 by Kim Kokkonen.
  524. All Rights Reserved.
  525.